<?php

use Illuminate\Database\Seeder;
use App\Models\User;
use App\Models\Users\Role;

class RoleSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $admin = Role::create(['name' => 'Founder', 'display_name' => '创始人', 'description' => '创始人', 'can_delete' => false, 'flag' => 100]);
        Role::create(['name' => 'Admin', 'display_name' => '管理员', 'description' => '管理员', 'is_default' => false, 'flag' => 99]);
        Role::create(['name' => 'User', 'display_name' => '用户', 'description' => '用户', 'is_default' => true, 'can_delete' => false]);

        $user = User::all()->first();
        $user->attachRole($admin);
        $user->save();
    }
}
